package org.sjcx.demo;

import java.io.IOException;
import java.util.HashMap;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import org.sjcx.common.HtmlRegexpUtil;
import org.sjcx.common.HtmlUtil;

public class demo {
	private static HtmlUtil htmlRegexp;
	private static String[] netUrl = {
			"http://www.xxbiquge.com/5_5422/"
	};
	static Document doc = null;
	/**
	 * 获取章节
	 */
	public static String getContentUrl(int num){
		doc = null;
		HashMap<Object, Object> map = new HashMap<Object, Object>();
		try {
			doc = Jsoup.connect(netUrl[0]).get();
			
			Element content = doc.getElementById("at");
			Elements links = content.getElementsByTag("a");
			int i = 0;
			for (Element link : links) {
			  String linkHref = link.attr("href");
			  String linkText = link.text();
			  i++;
			  map.put(i, netUrl[0]+linkHref);
			}
			
		} catch (IOException e) {
			e.printStackTrace();
		}
		return map.get(num).toString();
	}
	
	public static String getContent(){
		doc = null;
		try {
			doc = Jsoup.connect(getContentUrl(1)).get();
			Element content = doc.getElementById("contents");
//			System.out.println(content.toString());
			String con = content.toString();
			con = con.replaceAll("２３Ｕｓ．ｃｏｍ", "");
			System.out.println( con );
//			System.out.println(htmlRegexp.getTextFromHtml(content.toString()));
		} catch (IOException e) {
			e.printStackTrace();
		}
		return null;
	}
	
	public static void main(String[] args) {
		
		System.out.println(java.lang.StrictMath.pow(2, 3*5));
//		getContent();
			
	}
}
